<%@page import="java.util.Date"%>
<html>
<body>

	<%
		String operando = request.getParameter("op").toLowerCase();
		float n1 = Float.parseFloat(request.getParameter("n1"));
		float n2 = Float.parseFloat(request.getParameter("n2"));
		
		float result = 0 ;
		
		boolean parametrosOK = true;

		if (operando.equals("somar")){
			result = n1 + n2;
			operando = "+";
		}
		else if (operando.equals("subtrair")){
			result = n1 - n2;
			operando = "-";
		}
		else if (operando.equals("multiplicar")){
			result = n1 * n2;
			operando = "*";
		}
		else if (operando.equals("dividir")){
			result = n1 / n2;
			operando = "/";
		}
		else
			parametrosOK = false;
		
		if(parametrosOK){
			out.println("Operacao:<br>");
			out.println(n1 + " " + operando + " " + n2 +" = " + result);
		}
		else
			out.println("Parametros errados...");
			
	%>

</body>
</html>